package chap11;

import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.Random;

public class Priority {
	public static void main(String[] args) {
		Random random=new Random();
		PriorityQueue<Double> pq=new PriorityQueue<>();
		for(int i=0;i<10;i++){
			pq.offer(random.nextDouble()*100);
		}
		System.out.println(pq.size());
		System.out.println(pq);
		Iterator<Double> it=pq.iterator();
		while(it.hasNext()){
			Double i=it.next();
			System.out.println(i);
		}
		for(int i=0;i<pq.size();i++){
			System.out.println(pq.poll());
		}
	}

}
